package com.xique.client.service.service.impl;

import com.xique.client.bean.domain.Client;
import com.xique.client.mapper.ClientMapper;
import com.xique.client.service.service.IClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
 * 岗亭Service业务层处理
 * 
 * @author shd
 * @date 2021-07-22
 */
@Service
public class ClientServiceImpl implements IClientService
{
    @Autowired
    private ClientMapper clientMapper;

    /**
     * 查询岗亭
     * 
     * @param id 岗亭ID
     * @return 岗亭
     */
    @Override
    public Client selectClientById(Long id)
    {
        return clientMapper.selectById(id);
    }

    /**
     * 批量查询岗亭
     *
     * @param ids 岗亭ID
     * @return 岗亭
     */
    @Override
    public List<Client> selectClientByIds(List<Long> ids) {
        return clientMapper.selectBatchIds(ids);
    }

    /**
     * 查询岗亭列表
     * 
     * @param client 岗亭
     * @return 岗亭
     */
    @Override
    public List<Client> selectClientList(Client client)
    {
        return clientMapper.selectClientList(client);
    }

    /**
     * 新增岗亭
     * 
     * @param client 岗亭
     * @return 结果
     */
    @Override
    public int insertClient(Client client)
    {
        return clientMapper.insert(client);
    }

    /**
     * 修改岗亭
     * 
     * @param client 岗亭
     * @return 结果
     */
    @Override
    public int updateClient(Client client)
    {
        return clientMapper.updateById(client);
    }

    /**
     * 批量删除岗亭
     * 
     * @param ids 需要删除的岗亭ID
     * @return 结果
     */
    @Override
    public int deleteClientByIds(Long[] ids)
    {
        return clientMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除岗亭信息
     * 
     * @param id 岗亭ID
     * @return 结果
     */
    @Override
    public int deleteClientById(Long id)
    {
        return clientMapper.deleteById(id);
    }

    @Override
    public double sumClientCash(Date startTime, String userId, String clientId) {
        return clientMapper.sumClientCash(startTime,userId,clientId);
    }
}
